/*************************************************************************
 *
 *  Copyright (C) 2013 Florian Dang <florian.coin@gmail.com>
 *
 *  This file is part of NatusVerse.
 *
 *  NatusVerse is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  NatusVerse is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with NatusVerse.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************************************************************************/

#include "raytracer/objects/light.h"

#include <stdio.h>
#include <cassert>

namespace raytracer
{
void Light::MoveX(float begin, float end, float& sign)
{
	//assert(Point().x() >= begin && Point().x() <= end);
	if(source().x() <= begin)
		sign = 1.0f;
	if(source().x() >= end)
		sign = -1.0f;

	source_.set_x(source().x() + sign * 5.0f);
}

void Light::Print() const
{
	printf("light: o");
	source().Print();
	printf(" ~ ");
	PrintLuminance();
	printf(")");
}

void Light::PrintLuminance() const
{
	printf("(%.3f %.3f %.3f", luminance().r, luminance().g, luminance().b);
}
}
